// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

using System;
using System.Collections.Generic;

namespace SnapObjects.Expressions
{
    internal interface IPolicyProvider<T>
    {
        bool SupportShortCircuit { get; }
        INestParseProvider<T> NestParser { get; }

        // +, -, *, /, %, ^
        T Addition(T left, T right, ParserOptions<T> options);
        T Subtraction(T left, T right, ParserOptions<T> options);
        T Multiply(T left, T right, ParserOptions<T> options);
        T Division(T left, T right, ParserOptions<T> options);
        T Modulus(T left, T right, ParserOptions<T> options);
        T Caret(T left, T right, ParserOptions<T> options);

        T Not(T body);
        T Negative(T body);
        T And(T left, T right);
        T Or(T left, T right);
        T Condition(T test, T ifTrue, T ifFalse);

        T List(IEnumerable<T> args);
        T Constant(object value);
        T Constant(object value, Type type);

        // relational
        T Equal(T left, T right, ParserOptions<T> options);
        T NotEqual(T left, T right, ParserOptions<T> options);
        T LessThan(T left, T right, ParserOptions<T> options);
        T GreaterThan(T left, T right, ParserOptions<T> options);
        T LessThanOrEqual(T left, T right, ParserOptions<T> options);
        T GreaterThanOrEqual(T left, T right, ParserOptions<T> options);
        T AndAlso(T left, T right, ParserOptions<T> options);
        T OrElse(T left, T right, ParserOptions<T> options);

        bool ShortCircuit(T test);

        T Identifier(string identifier, ParserOptions<T> options);
        bool TryInvokeMethod(string name, T args, ParserOptions<T> options, out T result);
    }
}
